/**
 * @author LKQ
 * @date 2022/2/27 15:08
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int[] findErrorNums(int[] nums) {
        int n = nums.length;
        int[] res = new int[2], cnt = new int[n + 1];
        for (int num: nums) {
            cnt[num]++;
        }
        for (int i = 1; i <= n; i++) {
            if (cnt[i] == 2) {
                res[0] = i;
            }
            if (cnt[i] == 0) {
                res[1] = i;
            }
        }
        return res;
    }
}
